package populator;

import java.util.HashSet;
import java.util.Set;

import model.Member;
import model.Item;
import model.Game;
import model.Team;

public class GamePopulator {

	public static Game getMatch() {
		Game match = new Game();
		match.setMapName("Map1");
		match.setMap(new int[]{1,2,3,4,5,6,7,8,9,0});
		match.setItens(getItens());
		match.setTeam1(getTeam("Team1"));
		match.setTeam2(getTeam("Team2"));
		return match;
	}

	private static Team getTeam(String name) {
		Team team = new Team();
		team.setName(name);
		team.setMembers(getMembers(name));
		return team;
	}

	private static Set<Member> getMembers(String teamName) {
		Set<Member> members = new HashSet<Member>();
		Item item = new Item();
		item.setName(teamName+"=item-name");
		item.setSource(teamName+"=item-soucer");
		members.add(new Member(teamName+"-Member1", item));
		members.add(new Member(teamName+"-Member2", item));
		members.add(new Member(teamName+"-Member3", item));
		members.add(new Member(teamName+"-Member4", item));
		return members ;
	}

	private static Set<Item> getItens() {
		HashSet<Item> itens = new HashSet<Item>();
		
		Item house = new Item();
		house.setName("house");
		house.setSource("resource/house.png");
		itens.add(house);
		
		Item rock = new Item();
		rock.setName("rock");
		rock.setSource("resource/rock.png");
		itens.add(rock);
		
		Item plant = new Item();
		plant.setName("plant");
		plant.setSource("resource/plant.png");
		itens.add(plant);
		
		return itens;
	}
	
}
